#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
简单的图片素描转换示例

直接调用本地的素描转换功能，无需MCP协议。
"""

import sys
import os

# 添加当前目录到Python路径
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

from undoom_sketch_mcp.server import convert_image_to_sketch, get_image_info

def main():
    """主函数 - 直接调用素描转换功能"""
    
    # 图片路径
    image_path = r"D:\mcp_test\Cool Romantic Anime Character.png"
    
    print("🎨 图片素描转换示例")
    print("=" * 50)
    
    # 检查图片是否存在
    if not os.path.exists(image_path):
        print(f"❌ 图片文件不存在: {image_path}")
        return
    
    print(f"📁 输入图片: {os.path.basename(image_path)}")
    
    # 获取图片信息
    print("\n📊 获取图片信息...")
    info_result = get_image_info(image_path)
    print(info_result)
    
    # 转换为经典素描风格
    print("\n🎨 转换为经典素描风格...")
    classic_result = convert_image_to_sketch(
        image_path=image_path,
        blur_size=21,
        contrast=256.0,
        style="classic"
    )
    print(f"结果: {classic_result}")
    
    # 转换为详细素描风格
    print("\n🎨 转换为详细素描风格...")
    detailed_result = convert_image_to_sketch(
        image_path=image_path,
        blur_size=21,
        contrast=256.0,
        style="detailed"
    )
    print(f"结果: {detailed_result}")
    
    # 转换为柔和素描风格
    print("\n🎨 转换为柔和素描风格...")
    soft_result = convert_image_to_sketch(
        image_path=image_path,
        blur_size=21,
        contrast=256.0,
        style="soft"
    )
    print(f"结果: {soft_result}")
    
    print("\n✅ 所有转换完成!")
    print("\n💡 生成的素描图片保存在原图片相同目录下")
    print("   文件名格式: Sketch_{style}_{原文件名}.jpg")

if __name__ == "__main__":
    main()